package com.baizhi.shane.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Autowired
    private MyInterceptor myInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myInterceptor)
                .addPathPatterns("/**") // 拦截
                .excludePathPatterns("/doc.html**")
                .excludePathPatterns("/SysUser/login")
                .excludePathPatterns("/SysUser/signUp")
                .excludePathPatterns("/SysUser/hi")
                .excludePathPatterns("/exam_teacher/sign_up")
                .excludePathPatterns("/exam_teacher/login")
                .excludePathPatterns("/sys_division/get_division_list_by_level")
                .excludePathPatterns("/sys_division/get_division_level_info")
                .excludePathPatterns("/image/**")
                .excludePathPatterns("/error")
                .excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**")
                .excludePathPatterns("/**.ico")
                .excludePathPatterns("/shane/**")
                .excludePathPatterns("/user/**")
                .excludePathPatterns("/static/**");
    }

}